Imports OMANE.Common.UI
Imports System.Collections.ObjectModel
Imports System.Windows
Imports Infragistics.Windows.Chart
Imports System.Windows.Controls
Imports System.ComponentModel
Imports System.Windows.Media

''' <summary>
''' 
''' </summary>
''' <remarks></remarks>
<Serializable()> _
Public NotInheritable Class VMZoneGraphDefinition
    Inherits ViewModelBase
    Implements ICloneable

    Private _Title As String
    ''' <summary>
    ''' 
    ''' </summary>
    ''' <remarks></remarks>
    Public Property Title As String
        Get
            Return _Title
        End Get
        Set(ByVal value As String)
            OnPropertyChanging("Title")
            _Title = value
            OnPropertyChanged("Title")
        End Set
    End Property

    Private _Height As Double = Double.NaN
    ''' <summary>
    ''' 
    ''' </summary>
    ''' <remarks></remarks>
    Public Property Height As Double
        Get
            Return _Height
        End Get
        Set(ByVal value As Double)
            OnPropertyChanging("Height")
            _Height = value
            OnPropertyChanged("Height")
            RaiseEvent LayoutChange(Me, EventArgs.Empty)
        End Set
    End Property

    Private _Width As Double = Double.NaN
    ''' <summary>
    ''' 
    ''' </summary>
    ''' <remarks></remarks>
    Public Property Width As Double
        Get
            Return _Width
        End Get
        Set(ByVal value As Double)
            OnPropertyChanging("Width")
            _Width = value
            OnPropertyChanged("Width")
            RaiseEvent LayoutChange(Me, EventArgs.Empty)
        End Set
    End Property

    Private _Top As Double
    ''' <summary>
    ''' 
    ''' </summary>
    ''' <remarks></remarks>
    Public Property Top As Double
        Get
            Return _Top
        End Get
        Set(ByVal value As Double)
            OnPropertyChanging("Top")
            _Top = value
            OnPropertyChanged("Top")
            RaiseEvent LayoutChange(Me, EventArgs.Empty)
        End Set
    End Property

    Private _Left As Double
    ''' <summary>
    ''' 
    ''' </summary>
    ''' <remarks></remarks>
    Public Property Left As Double
        Get
            Return _Left
        End Get
        Set(ByVal value As Double)
            OnPropertyChanging("Left")
            _Left = value
            OnPropertyChanged("Left")
            RaiseEvent LayoutChange(Me, EventArgs.Empty)
        End Set
    End Property

    Private _Bottom As Double
    ''' <summary>
    ''' 
    ''' </summary>
    ''' <remarks></remarks>
    Public Property Bottom As Double
        Get
            Return _Bottom
        End Get
        Set(ByVal value As Double)
            OnPropertyChanging("Bottom")
            _Bottom = value
            OnPropertyChanged("Bottom")
            RaiseEvent LayoutChange(Me, EventArgs.Empty)
        End Set
    End Property

    Private _Right As Double
    ''' <summary>
    ''' 
    ''' </summary>
    ''' <remarks></remarks>
    Public Property Right As Double
        Get
            Return _Right
        End Get
        Set(ByVal value As Double)
            OnPropertyChanging("Right")
            _Right = value
            OnPropertyChanged("Right")
            RaiseEvent LayoutChange(Me, EventArgs.Empty)
        End Set
    End Property

    Private _HAlign As Object = 3
    ''' <summary>
    ''' 
    ''' </summary>
    ''' <remarks></remarks>
    Public Property HAlign As Object
        Get
            Return _HAlign
        End Get
        Set(ByVal value As Object)
            OnPropertyChanging("HAlign")
            _HAlign = value
            OnPropertyChanged("HAlign")
            If _HAlign = HorizontalAlignment.Stretch Then
                Width = Double.NaN
            End If
            RaiseEvent LayoutChange(Me, EventArgs.Empty)
        End Set
    End Property

    Private _VAlign As Object = 3
    ''' <summary>
    ''' 
    ''' </summary>
    ''' <remarks></remarks>
    Public Property VAlign As Object
        Get
            Return _VAlign
        End Get
        Set(ByVal value As Object)
            OnPropertyChanging("VAlign")
            _VAlign = value
            OnPropertyChanged("VAlign")
            If _VAlign = VerticalAlignment.Stretch Then
                Height = Double.NaN
            End If
            RaiseEvent LayoutChange(Me, EventArgs.Empty)
        End Set
    End Property

    Private _HeightAuto As Boolean = True
    ''' <summary>
    ''' 
    ''' </summary>
    ''' <remarks></remarks>
    Public Property HeightAuto As Boolean
        Get
            Return _HeightAuto
        End Get
        Set(ByVal value As Boolean)
            OnPropertyChanging("HeightAuto")
            _HeightAuto = value
            OnPropertyChanged("HeightAuto")
            RaiseEvent LayoutChange(Me, EventArgs.Empty)
        End Set
    End Property

    Private _WidthAuto As Boolean = True
    ''' <summary>
    ''' 
    ''' </summary>
    ''' <remarks></remarks>
    Public Property WidthAuto As Boolean
        Get
            Return _WidthAuto
        End Get
        Set(ByVal value As Boolean)
            OnPropertyChanging("WidthAuto")
            _WidthAuto = value
            OnPropertyChanged("WidthAuto")
            RaiseEvent LayoutChange(Me, EventArgs.Empty)
        End Set
    End Property

    Private _TopAuto As Boolean = True
    ''' <summary>
    ''' 
    ''' </summary>
    ''' <remarks></remarks>
    Public Property TopAuto As Boolean
        Get
            Return _TopAuto
        End Get
        Set(ByVal value As Boolean)
            OnPropertyChanging("TopAuto")
            _TopAuto = value
            OnPropertyChanged("TopAuto")
            RaiseEvent LayoutChange(Me, EventArgs.Empty)
        End Set
    End Property

    Private _LeftAuto As Boolean = True
    ''' <summary>
    ''' 
    ''' </summary>
    ''' <remarks></remarks>
    Public Property LeftAuto As Boolean
        Get
            Return _LeftAuto
        End Get
        Set(ByVal value As Boolean)
            OnPropertyChanging("LeftAuto")
            _LeftAuto = value
            OnPropertyChanged("LeftAuto")
            RaiseEvent LayoutChange(Me, EventArgs.Empty)
        End Set
    End Property

    Private _BottomAuto As Boolean = True
    ''' <summary>
    ''' 
    ''' </summary>
    ''' <remarks></remarks>
    Public Property BottomAuto As Boolean
        Get
            Return _BottomAuto
        End Get
        Set(ByVal value As Boolean)
            OnPropertyChanging("BottomAuto")
            _BottomAuto = value
            OnPropertyChanged("BottomAuto")
            RaiseEvent LayoutChange(Me, EventArgs.Empty)
        End Set
    End Property

    Private _RightAuto As Boolean = True
    ''' <summary>
    ''' 
    ''' </summary>
    ''' <remarks></remarks>
    Public Property RightAuto As Boolean
        Get
            Return _RightAuto
        End Get
        Set(ByVal value As Boolean)
            OnPropertyChanging("RightAuto")
            _RightAuto = value
            OnPropertyChanged("RightAuto")
            RaiseEvent LayoutChange(Me, EventArgs.Empty)
        End Set
    End Property

    Private _HAlignAuto As Boolean = True
    ''' <summary>
    ''' 
    ''' </summary>
    ''' <remarks></remarks>
    Public Property HAlignAuto As Boolean
        Get
            Return _HAlignAuto
        End Get
        Set(ByVal value As Boolean)
            OnPropertyChanging("HAlignAuto")
            _HAlignAuto = value
            OnPropertyChanged("HAlignAuto")
            RaiseEvent LayoutChange(Me, EventArgs.Empty)
        End Set
    End Property

    Private _VAlignAuto As Boolean = True
    ''' <summary>
    ''' 
    ''' </summary>
    ''' <remarks></remarks>
    Public Property VAlignAuto As Boolean
        Get
            Return _VAlignAuto
        End Get
        Set(ByVal value As Boolean)
            OnPropertyChanging("VAlignAuto")
            _VAlignAuto = value
            OnPropertyChanged("VAlignAuto")
            RaiseEvent LayoutChange(Me, EventArgs.Empty)
        End Set
    End Property

    Private _BackColor As Color
    Public Property BackColor As Color
        Get
            Return _BackColor
        End Get
        Set(ByVal value As Color)
            OnPropertyChanging("BackColor")
            _BackColor = value
            OnPropertyChanged("BackColor")
        End Set
    End Property

    Private _BorderColor As Color
    Public Property BorderColor As Color
        Get
            Return _BorderColor
        End Get
        Set(ByVal value As Color)
            OnPropertyChanging("BorderColor")
            _BorderColor = value
            OnPropertyChanged("BorderColor")
        End Set
    End Property

    Private _BorderSize As Double
    Public Property BorderSize As Double
        Get
            Return _BorderSize
        End Get
        Set(ByVal value As Double)
            OnPropertyChanging("BorderSize")
            _BorderSize = value
            OnPropertyChanged("BorderSize")
        End Set
    End Property

    Private _CornerRadius As Double
    Public Property CornerRadius As Double
        Get
            Return _CornerRadius
        End Get
        Set(ByVal value As Double)
            OnPropertyChanging("CornerRadius")
            _CornerRadius = value
            OnPropertyChanged("CornerRadius")
        End Set
    End Property

    Private _BackColorAuto As Boolean
    Public Property BackColorAuto As Boolean
        Get
            Return _BackColorAuto
        End Get
        Set(ByVal value As Boolean)
            OnPropertyChanging("BackColorAuto")
            _BackColorAuto = value
            OnPropertyChanged("BackColorAuto")
        End Set
    End Property

    Private _BorderColorAuto As Boolean
    Public Property BorderColorAuto As Boolean
        Get
            Return _BorderColorAuto
        End Get
        Set(ByVal value As Boolean)
            OnPropertyChanging("BorderColorAuto")
            _BorderColorAuto = value
            OnPropertyChanged("BorderColorAuto")
        End Set
    End Property

    Private _BorderSizeAuto As Boolean
    Public Property BorderSizeAuto As Boolean
        Get
            Return _BorderSizeAuto
        End Get
        Set(ByVal value As Boolean)
            OnPropertyChanging("BorderSizeAuto")
            _BorderSizeAuto = value
            OnPropertyChanged("BorderSizeAuto")
        End Set
    End Property

    Private _CornerRadiusAuto As Boolean
    Public Property CornerRadiusAuto As Boolean
        Get
            Return _CornerRadiusAuto
        End Get
        Set(ByVal value As Boolean)
            OnPropertyChanging("CornerRadiusAuto")
            _CornerRadiusAuto = value
            OnPropertyChanged("CornerRadiusAuto")
        End Set
    End Property

    Public Event LayoutChange As EventHandler

    ''' <summary>
    ''' 
    ''' </summary>
    ''' <remarks></remarks>
    <Xml.Serialization.XmlIgnore()> _
    Public Property Detail As Object

    ''' <summary>
    ''' 
    ''' </summary>
    ''' <remarks></remarks>
    Public Property DetailInstance As Object

    ''' <summary>
    ''' 
    ''' </summary>
    ''' <remarks></remarks>
    <Xml.Serialization.XmlIgnore()> _
    Public Property DetailEdit As VMEditableObject
        Get
            Return TryCast(Detail, VMEditableObject)
        End Get
        Set(ByVal value As VMEditableObject)
            Detail = value
        End Set
    End Property

    Sub ReCalculate()
        Try
            DetailInstance.ReCalculate()
        Catch ex As Exception

        End Try
    End Sub

    Public Function Clone() As Object Implements System.ICloneable.Clone
        'Return New VMZoneGraphDefinition() With {
        '    .Height = _Height,
        '    .Width = _Width
        '}
    End Function
End Class
